package Text;

public class Demo4 {
    public static void main(String[] args) {
        double h = 100;//定义基础高度
        double re = 0;//定义反弹高度
        double sum = 0;//定义总米数

        for (int i = 1; i <= 10; i++) {

            sum = sum + h + re;
//            System.out.println("sum = " + sum);
            h = h / 2;
//            System.out.println("h = " + h);
            re = h;
//            System.out.println("re = " + re);
        }
        System.out.println("共经过"+sum+"米");
        System.out.println("第十次反弹高度为："+re+"米");
    }
}
